package cn.tannn.tgateway.filter;

import cn.tannn.tgateway.GatewayFilter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * demo filter
 *
 * @author <a href="https://t.tannn.cn/">tan</a>
 * @date 2024/5/31 上午8:36
 */
@Slf4j
@Component("demoFilter")
public class DemoFilter implements GatewayFilter {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange) {
        log.debug(" ===>>> tan Gateway [pre] web demo filter ...");
        exchange.getRequest().getHeaders().toSingleValueMap()
                .forEach((k, v) -> log.info("{}:{}", k, v));
        return Mono.empty();
    }
}
